/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.machineryrental.service;

import cz.muni.fi.pa165.machineryrental.dto.MachineDTO;
import cz.muni.fi.pa165.machineryrental.entities.Machine;
import java.util.List;

/**
 * Service interface for Machine
 * @author Jozef Triscik
 */
public interface MachineService {
    
    /**
     * Returns machine with given id.
     * 
     * @param id Identifier of requested machine.
     * @return Machine with given identifier.
     * @throws IllegalArgumentException If given id is null.
     */
    public MachineDTO getById(long id);
    
    /**
     * Creates given machine in database.
     * 
     * @param machine Machine to persist into database.
     * @throws IllegalArgumentException If given machine is null.
     */
    public void create(MachineDTO machine);
    
    /**
     * Updates given machine in database.
     * 
     * @param machine Machine to update
     * @throws IllegalArgumentException If given machine is null.
     */
    public void update(MachineDTO machine);
    
    /**
     * If exists, removes given machine from database.
     * 
     * @param machine Machine to remove
     * @throws IllegalArgumentException If given machine to remove is null.
     */
    public void remove(MachineDTO machine);
    
    /**
     * Returns all machines in database.
     * 
     * @return All machines by database.
     */
    public List<MachineDTO> findAll();
    
    /**
     * Retuns machine with given code from database.
     * 
     * @param code Unique code of machine.
     * @return Machine with given code.
     */
    public MachineDTO findByCode(String code);
    
    /**
     * Returns all machines of given brand.
     * 
     * @param brand Brand of machines to return.
     * @return List of machines with given brand.
     * @throws IllegalArgumentException If given brand is null.
     */
    public List<MachineDTO> findByBrand(String brand);
    
    /**
     * Returns all machined made in given year.
     * 
     * @param year Year, in which is machine made.
     * @return List of machines made in given year.
     */
    public List<MachineDTO> findByYear(int year);
}
